#include <cstdio>
#include <string>
#include <iostream>

int ans[1000000];


std::string GetTwoPower(int P){
    int len=1;
    ans[0] = 2;
    for(int i=1;i<P; i++){
        for (int j=0;j<len;j++){
            ans[j] *= 2;
        }

        for (int j=0;j<len;j++){
            ans[j+1] += ans[j]/10;
            ans[j] %= 10;
        }

        while(ans[len]){
            ans[len+1] += ans[len]/10;
            ans[len++] %= 10;
        }
    }

    std::string result(len, '0');

    for(int i=0; i<len; i++){
        result[i] = ans[len - i - 1] + '0';
    }

    return result;
}

/**
 * https://www.luogu.com.cn/problem/P1045
 * 麦森数
 */
int main(){
    int P;
    scanf("%d", &P);

    std::string result = GetTwoPower(P);

    int len = result.length();
    printf("%d\n", len);

    result[len-1] = result[len-1]- 1;

   
    if(len >= 500){
        int cnt=0;
        for(int i=len-500; i<len; i++){
            printf("%c", result[i]);
            cnt++;
            if(cnt == 50){
                printf("\n");
                cnt = 0;
            }
        }
    }else{
        int diff = 500-len;
        int cnt = 0;
        for(int i=0;i<diff;i++){
            printf("0");
            cnt++;
            if(cnt == 50){
                printf("\n");
                cnt = 0;
            }
        }

        for(int i=0; i<len; i++){
            printf("%c", result[i]);
            cnt++;
            if(cnt == 50){
                printf("\n");
                cnt = 0;
            }
        }
    }



    return 0;
}